//
//  SZLOptionViewController.m
//  Shengzhuli
//
//  Created by 卡忙科技 on 16/10/18.
//  Copyright © 2016年 kamangkeji. All rights reserved.
//

#import "SZLOptionViewController.h"
#import "AddressField.h"
#import "PersonNetWork.h"
#import "MBProgressHUD+MJ.h"
#import "SZLAccountHelper.h"

@interface SZLOptionViewController ()
@property (weak, nonatomic) IBOutlet AddressField *optionTextView;

@end

@implementation SZLOptionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"意见反馈";
    self.optionTextView.placeHolder = @"请填写您的意见,您的意见就是我们进步的最大动力";
}
- (IBAction)sureClicik:(UIButton *)btn
{
    if (self.optionTextView.text.length<1) {
        [MBProgressHUD showError:@"意见反馈不能为空" toView:self.view];
        return;
    }
    NSMutableDictionary *parame = [NSMutableDictionary dictionary];
    parame[@"token"] = [SZLAccountHelper shareInstance].token;
    parame[@"content"] = self.optionTextView.text;
    [PersonNetWork optionWithParame:parame response:^(BOOL success, NSString *msg) {
        if (success) {
            [MBProgressHUD showSuccess:@"反馈成功" toView:self.view];
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                [self.navigationController popViewControllerAnimated:YES];
            });
        }else{
            [MBProgressHUD showError:msg toView:self.view];
        }
    }];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self.view endEditing:YES];
}


@end
